let log4js = require('../logger');
module.exports = {
    //环境名称
    env: 'dev',
    //服务端口号
    port: 3001,
    // core
    core: {
        // origin: function (ctx) {
        //     //console.log(ctx.url);
        //     if (ctx.url=='/api/home/index2'){
        //         //这样就能只允许 http://localhost:8080 这个域名的请求了
        //         return 'http://127.0.0.1:8082';
        //     }
        //     // 允许来自所有域名请求
        //     return '*';
        // },
        exposeHeaders: ['X-Requested-With', 'USER_TOKEN'],
        maxAge: 5,
        credentials: true,
        allowMethods: ['GET', 'POST', 'DELETE', 'OPTIONS', 'PUT'],
        allowHeaders: ['Content-Type', 'Origin', 'X-Requested-With','Accept','ACCESS-TOKEN','access-token'],
    },
    whiteList: [
        'http://127.0.0.1:8080',
        'http://127.0.0.1:8082',
        'http://127.0.0.1:8889',
        //'http://127.0.0.1:3001',
    ],
    mongodb: {
        uri:'mongodb://root:bobo123321@47.92.27.189:27017/student?authSource=admin',
        db: 'Student',
    },
    auth: {
        access_key: "access-token",
        access_verify_key: "access-verify-token",
        access_token: 'fsfsfsf3434fuerfsfnlfsjfsfsfgdgdgdgd&fdfdlfldf',
        salt: 'fsfsfsf3434fuerfsfnlfsjfsfsfgdgdgdgd&fdfdlfldf',
        wechatTtl: 3600 * 24 * 7,
        adminTtl: 3600 * 2,
        wechatLoginPrefix: "wechat:user:openid:",
        adminLoginPrefix: "admin:user:info:",
        adminVerifyLoginPrefix: "admin:verify:user:info:"
    },
    logger: {
        accessLogger: () => log4js.koaLogger(log4js.getLogger('out')),
        infoLogger: log4js.getLogger('out'),
        errorLogger: log4js.getLogger('out'),
        //infoLogger: log4js.getLogger('applicationInfo'),
        //errorLogger: log4js.getLogger('applicationError'),
        con: log4js.getLogger('out')
    },
    redis: {
        port: 6379,          // Redis port
        host: '47.92.27.189',   // Redis host
        //prefix: 'tb-ski:', //存诸前缀
        //ttl: 60 * 60 * 23,  //过期时间
        //family: 4,
        password: 'huaxue#@3',
        db: 0
    },
    //邮件配置
    email:{
        service: 'QQ',
        user: '1732836423@qq.com',
        pass: 'uquliwjqkhqaefff',
        expires: 15 * 60,
    },
    wechat: {
        appId: 'wx015a1c2df4282b80',
        secret: '1952ca8e77d01777d0d2925e10d97b81',
        tokenKey: 'wechat:access:token:',
        expire: 7200,
    },
    wechatTemplate:{
        courseOrder:'UAvcaP8nUfyrawFgWvdWqeh-Ko6P2b-oIqBoz5kEnGo',
            courseEnd:'zdFzhJvMwVr4Lf7un0sjllR6G0P7GJzZkMoFkcil6E0'
    }
};
